﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EYangFramework.Common.Ninject
{
    [AttributeUsage(AttributeTargets.Assembly,AllowMultiple =false,Inherited =false)]
    public class AutoBindAssemblyAttribute:Attribute
    {
        //指定需要被通过泛型绑定的服务接口及实例的接口
        public Type ServiceType;
        public Type ImpleType;
        public Type EntityType;
        public AutoBindAssemblyAttribute(Type serviceType = null, Type impleType = null, Type entityType = null)
        {
            if (impleType != null && serviceType != null && ((impleType.IsInterface || impleType.IsAbstract)))
            {
                throw new NinjectException("程序集统一注册指定的子类应该继承自服务类,同时子类不能为接口或者抽象类");
            }
            this.ServiceType = serviceType;
            this.ImpleType = impleType;
            this.EntityType = entityType;
        }
    }
}
